package com.gary.collector;

import com.gary.service.AppHealthCheckExporterService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 普罗米修斯采集
 */
@Slf4j
@Component
public class AppHealthCheckExporterCollector {

    @Autowired
    private AppHealthCheckExporterService exporterService;

    // 30 秒采集一次
    @Scheduled(fixedDelay = 1000 * 10)
    public void metricCollect(){
        // 从redis 获取上次检查结果 上报到普罗米修斯
//        log.info("健康检查采集...");
        exporterService.exporterPrometheusMetrics();
    }
}
